<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="layui/css/layui.css">
<title>Insert title here</title>
</head>
<body>
<div class="layui-fluid">
<div style="margin-top:50px;"><h2 style="color:#009688;margin-left:520px;">请假申请</h2><hr class="layui-bg-green"></div>
  <div style="margin-top:100px;margin-left:380px;">
    <form action="" class="layui-form">
      <div class="layui-form-item">
        <label class="layui-form-label">姓名</label>
        <div class="layui-input-inline">
           <input class="layui-input" type="text" readonly="readonly" name="userName" th:value="${session.loginUser.userName}">
        </div>
      </div>
      
     <div class="layui-form-item">
        <label class="layui-form-label">工号</label>
        <div class="layui-input-inline">
           <input class="layui-input" type="text" readonly="readonly" name="empNo" th:value="${session.loginUser.account}">
        </div>
      </div>
      
      <div class="layui-form-item">
        <label class="layui-form-label">请假类型</label>
        <div class="layui-input-inline">
           <select name="type" id="type">
             <option value="事假">事假</option>
             <option value="病假">病假</option>
             <option value="婚假">婚假</option>
             <option value="丧假">丧假</option>
             <option value="出差">出差</option>
           </select>
        </div>
      </div>
      
      <div class="layui-form-item">
      <div class="layui-block">
        <label class="layui-form-label">时间</label>
        <div class="layui-input-inline" style="width:100px;">
          <input class="layui-input" type="text" name="starTime" id="starTime" placeholder="开始日期" lay-verify="required">
        </div>
        <div class="layui-form-mid">--</div>
        <div class="layui-input-inline" style="width:100px;">
          <input class="layui-input" type="text" name="endTime" id="endTime" placeholder="结束日期" lay-verify="required">
        </div>
      </div>
      </div>
      
     <div class="layui-form-item">
       <div class="layui-input-block">
         <button  class="layui-btn" lay-submit lay-filter="vocate">确定</button>
       </div>
    </div>
    </form>
  </div>
</div>

<script src="layui/layui.js"></script>
<script>
  layui.use('form',function(){
	  var form=layui.form;
	  var $=layui.jquery;
	//  form.render('select','#type');
	  form.on('submit(vocate)',function(data){
		  $.ajax({
			url:'/addVocate',
			method:'post',
			contentType:'application/json;charset=utf-8',
			data:JSON.stringify(data.field),
			success:function(msg){
				if(msg){
					layer.msg("成功");
				}else{layer.msg("失败");}
				
			},
			error:function(msg){layer.msg("失败");}
		  });
		  
	  });
  });
  layui.use('laydate',function(){
	  var laydate=layui.laydate;
	  laydate.render({
		  elem:'#starTime',
		  type:'date',		  
		  min:0
	  });
	  laydate.render({
		  elem:'#endTime',
		  type:'date',
		  min:0
	  });
  });
</script>
</body>
</html>